import Vue from 'vue'
import Router from 'vue-router' // 1.安装路由
// 2.引入各个组件
import HelloWorld2 from '@/components/HelloWorld2'
import HelloWorld from '../components/HelloWorld'
import Login from '../components/Login'
import Register from '../components/Register'
import Personal from '../components/Personal'
import Home from '../components/Home'
import Commodity from '../components/Commodity'
// 3.使用路由，把路由放到vue对象中
Vue.use(Router)

// 4.定义路由组，将相关页面加入

export default new Router({
  routes: [
    {
      path: '/HelloWorld',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/HelloWorld2',
      name: 'HelloWorld2',
      component: HelloWorld2
    },
    {
      path: '/Register',
      name: Register,
      component: Register
    },
    {
      path: '/Personal',
      name: Personal,
      component: Personal
    },
    {
      path: '/Home',
      name: Home,
      component: Home
    },
    {
      path: '/Login',
      name: Login,
      component: Login
    },
    {
      path: '/Commodity',
      name: Commodity,
      component: Commodity
    },
    {
      path: '/',
      redirect: '/Login'
    }
  ]
})
